

import com.alibaba.fastjson.JSONObject;
import com.bjmashibing.system.huawei.Log;
import com.bjmashibing.system.huawei.SocketNIO;
import com.bjmashibing.system.huawei.oppo.oppo_push;
import com.google.api.client.json.Json;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.Map;

/**
 * @Classname oppo_test
 * @Description TODO
 * @Date 2021/1/9/009 11:26
 * @Created by Administrator
 */
public class oppo_test {
    private final static Logger logger = LoggerFactory.getLogger(SocketNIO.class);
    @Test
    public void test(){
//        oppo_push.send_message_oppo_to_regid("CN_a813bde520a0cf430007a023f4850e0f","火警",
//                "[" + "8612345678" + ":" + "|1110 00 000]","8612345678","|1110 00 000]");
        oppo_push.send_message_oppo_to_regid("CN_a813bde520a0cf430007a023f4850e0f","火警",
                "[" + "8612345678" + ":" + "|1110 00 000]","8612345678","|1110 00 000]");
    }


    @Test
    public void test2(){
        System.out.println("aaa");
        Map<String, Object> student = new HashMap<>();
        student.put("name", "野猿新一");
        student.put("age", 28);
        student.put("emails", new String[]{"1s" , "2s" , "4s","8s"});
        String json = new Gson().toJson(student.get("emails"));
//        logger.info("json=", json.toString());
        System.out.println(json);


        String jsonStr= "{\"pids\":[\"1s\",\"2s\",\"3s\",\"3s\"]}";
        String jsonStr2= "[\"1s\",\"2s\",\"3s\",\"3s\"]";
//        JsonArray jsonArray = new JsonParser().parse(jsonStr).getAsJsonObject().getAsJsonArray("pids").getAsJsonArray();
//        JsonArray jsonArray = new JsonParser().parse(jsonStr).getAsJsonObject().getAsJsonArray("pids").getAsJsonArray();
//        String jsonArray2 = new JsonParser().parse(jsonStr).getAsJsonObject().getAsJsonArray("pids").getAsString();

//        System.out.println(jsonArray.toString());
        System.out.println(jsonStr2);
    }
}
